package jco3.JCoDestination.demo3;

import java.io.File;

import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.JCoException;
import com.sap.conn.jco.ext.Environment;

public class FileDestinationDataProvider {
	
	public static JCoDestination getDestination() throws JCoException{
		File directory = new File(".");//这里定义文件路径
		String fileName = "SAP_AS";//文件名
		String suffix = "txt";//后缀
		
		FileDestinationDataProviderImp destDataProvider = new FileDestinationDataProviderImp();
		destDataProvider.setDestinationFile(directory, fileName, suffix);
		Environment.registerDestinationDataProvider(destDataProvider);
		
		JCoDestination dest = JCoDestinationManager.getDestination(fileName);
		return dest;
	}
}
